<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  <title>浪漫H5相册</title>
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=ZCOOL+KuaiLe&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.css" />
  <style>
    :root {
      --primary-color: #FF69B4;
      --secondary-color: #FFB6C1;
      --background-start: #ffafbd;
      --background-end: #ffc3a0;
      --text-color: #4A4A4A;
      --white: #fff;
      --shadow-color: rgba(255, 182, 193, 0.5);
    }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      -webkit-tap-highlight-color: transparent;
    }

    body {
      margin: 0;
      padding: 0;
      min-height: 100vh;
      font-family: 'ZCOOL KuaiLe', cursive, sans-serif;
      background: linear-gradient(135deg, var(--background-start) 0%, var(--background-end) 100%) fixed;
      color: var(--text-color);
      overflow: hidden;
      position: fixed;
      width: 100%;
      height: 100%;
    }

    .container {
      position: relative;
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 20px;
      background-color: transparent;
    }

    .swiper {
      width: 100%;
      height: 80vh;
      padding: 20px;
      background: transparent;
    }

    .swiper-slide {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      background: transparent;
      padding: 20px;
    }

    /* 强制覆盖 Swiper cards 效果的阴影 */
    .swiper-cards .swiper-slide,
    .swiper-cards .swiper-slide-active,
    .swiper-cards .swiper-slide-prev,
    .swiper-cards .swiper-slide-next {
      box-shadow: none !important;
    }

    /* 修改 Swiper 默认样式 */
    .swiper-slide-shadow-left,
    .swiper-slide-shadow-right {
      background-image: none !important;
    }

    .photo-container {
      width: min(75vw, 280px);
      background-color: rgba(255, 255, 255, 0.8);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      border-radius: 16px;
      border: 3px solid var(--secondary-color);
      box-shadow: 0 8px 30px var(--shadow-color);
      overflow: hidden;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      will-change: transform;
    }

    .photo {
      width: 100%;
      height: min(95vw, 380px);
      background-size: cover;
      background-position: center;
      cursor: pointer;
      border-bottom: 2px solid var(--secondary-color);
    }

    .photo-story {
      width: 100%;
      background: transparent;
      padding: 16px;
      font-size: 1.1em;
      line-height: 1.4;
      color: var(--primary-color);
      text-align: center;
    }

    .controls {
      position: fixed;
      bottom: 20px;
      left: 0;
      right: 0;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 20px;
      z-index: 100;
    }

    .music-btn {
      width: 48px;
      height: 48px;
      background: var(--primary-color);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      box-shadow: 0 4px 12px var(--shadow-color);
      transition: all 0.3s ease;
    }

    .music-btn:active {
      transform: scale(0.95);
    }

    .music-btn svg {
      width: 24px;
      height: 24px;
      fill: var(--white);
    }

    .heart-count {
      background: var(--white);
      color: var(--primary-color);
      border-radius: 24px;
      padding: 8px 16px;
      font-size: 1em;
      box-shadow: 0 4px 12px var(--shadow-color);
      display: flex;
      align-items: center;
      justify-content: center;
      min-width: 120px;
      height: 40px;
      gap: 4px;
    }

    .heart-count::before {
      content: '❤️';
      font-size: 1.2em;
      display: inline-flex;
      align-items: center;
    }

    .heart-count span {
      display: inline-flex;
      align-items: center;
    }

    .welcome-screen {
      position: fixed;
      inset: 0;
      background: rgba(255, 182, 193, 0.98);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      z-index: 9999;
      color: var(--white);
      text-align: center;
      cursor: pointer;
    }

    .welcome-heart {
      font-size: min(15vw, 5em);
      margin-bottom: 20px;
      animation: pulse 1.5s infinite;
      will-change: transform;
    }

    .welcome-text {
      font-size: min(5vw, 1.5em);
      padding: 20px;
      text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .overlay {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.7);
      backdrop-filter: blur(5px);
      -webkit-backdrop-filter: blur(5px);
      z-index: 999;
      opacity: 0;
      transition: opacity 0.3s ease;
      display: none;
    }

    .overlay.active {
      display: block;
      opacity: 1;
    }

    .swiper-pagination {
      display: none;
    }

    .swiper-pagination-bullet {
      width: 10px;
      height: 10px;
      background: var(--white);
      opacity: 0.5;
    }

    .swiper-pagination-bullet-active {
      background: var(--primary-color);
      opacity: 1;
    }

    .swiper-button-next,
    .swiper-button-prev {
      color: var(--primary-color);
    }

    @keyframes pulse {
      0% { transform: scale(1); }
      50% { transform: scale(1.1); }
      100% { transform: scale(1); }
    }

    .petal, .heart-float {
      position: fixed;
      pointer-events: none;
      z-index: 1;
      will-change: transform;
    }

    /* 添加互动元素的样式 */
    .interactive-element {
      position: fixed;
      pointer-events: none;
      z-index: 1000;
      transition: transform 0.3s ease;
    }

    .heart-float {
      position: fixed;
      pointer-events: none;
      z-index: 1000;
      animation: floatHeart 1.5s ease-out forwards;
    }

    @keyframes floatHeart {
      0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
      }
      25% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.9;
      }
      100% {
        transform: translate(-50%, -200%) scale(1);
        opacity: 0;
      }
    }

    @keyframes rotatePetal {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
    }

    /* 大爱心动画样式 */
    .big-heart {
      position: fixed;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%) scale(0);
      width: 300px;
      height: 300px;
      z-index: 2000;
      pointer-events: none;
      animation: bigHeartAnimation 3s ease-in-out forwards;
      filter: drop-shadow(0 0 20px rgba(255, 105, 180, 0.6));
    }

    .big-heart svg {
      width: 100%;
      height: 100%;
    }

    .big-heart path {
      fill: url(#heartGradient);
      stroke: #fff;
      stroke-width: 2;
      filter: url(#glow);
    }

    .heart-quote {
      position: absolute;
      bottom: -80px;
      left: 50%;
      transform: translateX(-50%);
      width: 340px;
      text-align: center;
      color: var(--primary-color);
      font-size: 20px;
      font-weight: bold;
      text-shadow: 0 2px 4px rgba(0,0,0,0.1);
      background: rgba(255, 255, 255, 0.95);
      padding: 15px 25px;
      border-radius: 25px;
      box-shadow: 0 4px 15px rgba(255, 105, 180, 0.3);
      animation: quoteAppear 0.5s ease-out forwards;
      opacity: 0;
      transform: translateX(-50%) translateY(20px);
    }

    @keyframes bigHeartAnimation {
      0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
      }
      15% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
      }
      30% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
      }
      80% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
      }
      100% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
      }
    }

    @keyframes quoteAppear {
      0% {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
      }
      100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
      }
    }

    @keyframes floatingHeart {
      0%, 100% {
        transform: translateY(0);
      }
      50% {
        transform: translateY(-15px);
      }
    }

    /* 特殊彩蛋动画样式 */
    .special-effect {
      position: fixed;
      inset: 0;
      z-index: 2001;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(255, 192, 203, 0.3);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      animation: specialEffectFade 5s ease-in-out forwards;
    }

    @keyframes specialEffectFade {
      0% { opacity: 0; }
      20% { opacity: 1; }
      80% { opacity: 1; }
      100% { opacity: 0; }
    }

    .special-heart-container {
      position: relative;
      width: 400px;
      height: 400px;
      animation: specialHeartPulse 2s infinite;
      filter: drop-shadow(0 0 30px rgba(255, 20, 147, 0.8));
    }

    @keyframes specialHeartPulse {
      0% { transform: scale(1) rotate(0deg); }
      25% { transform: scale(1.1) rotate(5deg); }
      50% { transform: scale(1) rotate(0deg); }
      75% { transform: scale(1.1) rotate(-5deg); }
      100% { transform: scale(1) rotate(0deg); }
    }

    .special-message {
      position: absolute;
      bottom: -100px;
      left: 50%;
      transform: translateX(-50%);
      font-size: 28px;
      color: #FF1493;
      text-align: center;
      background: rgba(255, 255, 255, 0.95);
      padding: 20px 40px;
      border-radius: 30px;
      box-shadow: 0 4px 20px rgba(255, 20, 147, 0.6);
      white-space: nowrap;
      animation: messageFloat 2s ease-in-out infinite;
    }

    @keyframes messageFloat {
      0%, 100% { transform: translateX(-50%) translateY(0); }
      50% { transform: translateX(-50%) translateY(-10px); }
    }

    @media (max-width: 600px) {
      .swiper {
        height: 70vh;
      }
      
      .photo {
        width: 70vw;
        height: 90vw;
      }
      
      .controls {
        padding: 0 16px;
        bottom: 16px;
      }

      .music-btn {
        width: 44px;
        height: 44px;
      }

      .heart-count {
        padding: 6px 14px;
        font-size: 0.9em;
      }
    }
  </style>
</head>
<body>
  <div class="container">
    <div class="welcome-screen" id="welcomeScreen">
      <div class="welcome-heart">💝</div>
      <div class="welcome-text">点击任意位置开始浪漫之旅</div>
    </div>
    <div id="petal-container"></div>
    <div class="swiper">
      <div class="swiper-wrapper" id="photoContainer"></div>
      <div class="swiper-pagination"></div>
      <div class="swiper-button-prev"></div>
      <div class="swiper-button-next"></div>
    </div>
    <div class="controls">
      <div class="heart-count" id="heartCount">爱心：0</div>
      <div class="music-btn" id="musicBtn" title="播放/暂停音乐">
        <svg viewBox="0 0 64 64"><path d="M32 8C18.745 8 8 18.745 8 32s10.745 24 24 24 24-10.745 24-24S45.255 8 32 8zm0 44c-11.046 0-20-8.954-20-20S20.954 12 32 12s20 8.954 20 20-8.954 20-20 20zm-4-28v16a2 2 0 0 0 3.09 1.664l10-8a2 2 0 0 0 0-3.328l-10-8A2 2 0 0 0 28 16z"/></svg>
      </div>
    </div>
  </div>
  <audio id="bgm" src="heart.mp3" loop preload="auto"></audio>
  <script src="https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.min.js"></script>
  <script>
    // 相册数据
    const photos = [
      { src: 'imgs/1.jpeg', story: '第一次见面，怦然心动' },
      { src: 'imgs/2.jpeg', story: '一起看日落的傍晚' },
      { src: 'imgs/3.jpeg', story: '第一次牵手的瞬间' },
      { src: 'imgs/4.jpeg', story: '你笑起来真好看' },
      { src: 'imgs/5.jpeg', story: '我们的纪念日' },
      { src: 'imgs/6.jpeg', story: '一起旅行的回忆' },
      { src: 'imgs/7.jpeg', story: '你送我的小礼物' },
      { src: 'imgs/8.jpeg', story: '下雨天的温暖陪伴' },
      { src: 'imgs/9.jpeg', story: '一起做饭的快乐' },
      { src: 'imgs/10.jpeg', story: '深夜的温柔拥抱' },
      { src: 'imgs/11.jpeg', story: '一起追剧的时光' },
      { src: 'imgs/12.jpeg', story: '你最爱的奶茶' },
      { src: 'imgs/13.jpeg', story: '一起许下的心愿' },
      { src: 'imgs/14.jpeg', story: '你生气时也很可爱' },
      { src: 'imgs/15.jpeg', story: '一起跨年的夜晚' },
      { src: 'imgs/16.jpeg', story: '你为我做的美食' },
      { src: 'imgs/17.jpeg', story: '一起看星星的夜晚' },
      { src: 'imgs/18.jpeg', story: '你送我的手写信' },
      { src: 'imgs/19.jpeg', story: '未来的每一天都想和你一起' }
    ];

    // 土味情话数组
    const loveQuotes = [
      "你知道你和星星有什么区别吗？星星在天上，你在我心里。",
      "你走在我前面，我可以保护你；你走在我后面，我可以等你；你走在我身边，我可以牵着你。",
      "我想变成你的影子，这样就可以一直陪在你身边。",
      "你知道我最喜欢什么神吗？是你的眼神。",
      "你知道我的缺点是什么吗？是缺点你。",
      "你知道我的心在哪里吗？在你那里。",
      "你是我这一生最美的意外。",
      "遇见你是我最美好的相遇。",
      "你是我最想要的礼物。",
      "你是我的小太阳，是我的整个世界。",
      "你是我的世界，世界都在你那里。",
      "你是我的独家记忆，我的专属宝贝。",
      "你是我的小确幸，是我的每日幸福。",
      "你是我的小可爱，是我的心头爱。",
      "你是我的小幸运，是我的命中注定。",
      "你是我的小甜心，是我的心上人。",
      "你是我的小宝贝，是我的掌心宝。",
      "你是我的小天使，是我的守护神。",
      "你是我的小公主，是我的唯一。",
      "你是我的小仙女，是我的梦中人。",
      "你知道我最喜欢的数字是什么吗？是520，因为我爱你。",
      "你知道我为什么要学写字吗？因为想写下我们的故事。",
      "你知道我为什么要学摄影吗？因为想记录下我们的点点滴滴。",
      "你知道我为什么要学做饭吗？因为想给你做最好吃的菜。",
      "你知道我为什么要学开车吗？因为想带你去看世界。",
      "你知道我为什么要努力工作吗？因为想给你最好的生活。",
      "你知道我为什么要存钱吗？因为想和你一起买房。",
      "你知道我为什么要健身吗？因为想保护你一辈子。",
      "你知道我为什么要早起吗？因为想多看你一眼。",
      "你知道我为什么要晚睡吗？因为舍不得和你说再见。",
      "你是我的小太阳，是我的整个世界。",
      "你是我的小月亮，是我的每个夜晚。",
      "你是我的小星星，是我的满天繁星。",
      "你是我的小彩虹，是我的七彩人生。",
      "你是我的小雨滴，是我的甘甜雨露。",
      "你是我的小雪花，是我的纯白世界。",
      "你是我的小风筝，是我放飞的梦想。",
      "你是我的小蝴蝶，是我追逐的美丽。",
      "你是我的小花朵，是我的芬芳岁月。",
      "你是我的小树苗，是我的茁壮成长。",
      "你是我的小溪流，是我的潺潺流水。",
      "你是我的小海洋，是我的广阔天地。",
      "你是我的小沙漠，是我的绿洲希望。",
      "你是我的小草原，是我的辽阔天地。",
      "你是我的小森林，是我的生机勃勃。",
      "你是我的小山丘，是我的巍峨高山。",
      "你是我的小云朵，是我的自由飘逸。",
      "你是我的小风铃，是我的悦耳清音。",
      "你是我的小音符，是我的动人旋律。",
      "你是我的小画笔，是我的绚丽人生。",
      "你是我的小诗句，是我的浪漫情怀。",
      "你是我的小故事，是我的精彩人生。",
      "你是我的小相框，是我的美好回忆。",
      "你是我的小钥匙，是我的心门密码。",
      "你是我的小口袋，是我的温暖依靠。"
    ];

    // 初始化 Swiper
    function initSwiper() {
      const photoContainer = document.getElementById('photoContainer');
      
      // 创建幻灯片
      photos.forEach((photo, index) => {
        const slide = document.createElement('div');
        slide.className = 'swiper-slide';
        
        const container = document.createElement('div');
        container.className = 'photo-container';
        
        const photoDiv = document.createElement('div');
        photoDiv.className = 'photo';
        photoDiv.style.backgroundImage = `url('${photo.src}')`;
        
        const story = document.createElement('div');
        story.className = 'photo-story';
        story.textContent = photo.story;
        
        container.appendChild(photoDiv);
        container.appendChild(story);
        slide.appendChild(container);
        photoContainer.appendChild(slide);
      });

      // 初始化 Swiper
      const swiper = new Swiper('.swiper', {
        effect: 'cards',
        grabCursor: true,
        navigation: {
          nextEl: '.swiper-button-next',
          prevEl: '.swiper-button-prev',
        },
        loop: true,
        speed: 800,
        autoplay: {
          delay: 3000,
          disableOnInteraction: false,
        },
        cardsEffect: {
          slideShadows: false,
          rotate: true,
          perSlideRotate: 4,
          perSlideOffset: 8,
        },
      });

      return swiper;
    }

    // 飘落效果
    let lastPetalTime = 0;
    const PETAL_INTERVAL = 1000;

    function createPetal() {
      const now = Date.now();
      if (now - lastPetalTime < PETAL_INTERVAL) return;
      lastPetalTime = now;

      const petal = document.createElement('div');
      petal.className = Math.random() > 0.5 ? 'petal' : 'heart-float';
      const size = Math.random() * 18 + 18;
      
      Object.assign(petal.style, {
        width: size + 'px',
        height: size + 'px',
        left: Math.random() * 100 + 'vw',
        top: '-40px',
        opacity: Math.random() * 0.5 + 0.5
      });

      petal.innerHTML = petal.className === 'petal' ?
        '<svg viewBox="0 0 32 32"><path fill="#FFB6C1" d="M16 29S2 18 2 10a7 7 0 0 1 14 0 7 7 0 0 1 14 0c0 8-14 19-14 19z"/></svg>' :
        '<svg viewBox="0 0 32 32"><path fill="#FF69B4" d="M23.6,3.6c-2.1,0-4,1-5.6,2.7C16.4,4.6,14.5,3.6,12.4,3.6C8.1,3.6,4.6,7.1,4.6,11.4c0,7.1,11.4,16.9,11.4,16.9s11.4-9.8,11.4-16.9C27.4,7.1,23.9,3.6,23.6,3.6z"/></svg>';

      document.body.appendChild(petal);

      requestAnimationFrame(() => {
        petal.style.transform = `translateY(${window.innerHeight + 40}px) translateX(${(Math.random() - 0.5) * 100}px) rotate(${Math.random() * 360}deg)`;
        petal.style.transition = 'transform 6s linear, opacity 6s linear';
        petal.style.opacity = '0';
      });

      setTimeout(() => petal.remove(), 6000);
    }

    // 初始化
    document.addEventListener('DOMContentLoaded', () => {
      const welcomeScreen = document.getElementById('welcomeScreen');
      const bgm = document.getElementById('bgm');
      const musicBtn = document.getElementById('musicBtn');
      const heartCount = document.getElementById('heartCount');
      let playing = false;
      let swiper;
      let hearts = 0;
      let isShowingBigHeart = false;

      // 特殊彩蛋消息
      const specialMessages = [
        "💝 爱你一万年！",
        "💖 你就是我的全世界！",
        "💕 遇见你是我最大的幸福！",
        "💗 余生请多指教！",
        "💓 你是我最特别的人！"
      ];

      // 显示大爱心
      function showBigHeart() {
        if (isShowingBigHeart) return;
        isShowingBigHeart = true;

        const bigHeart = document.createElement('div');
        bigHeart.className = 'big-heart';
        
        bigHeart.innerHTML = `
          <svg viewBox="0 0 512 512">
            <defs>
              <linearGradient id="heartGradient" x1="0%" y1="0%" x2="100%" y2="100%">
                <stop offset="0%" style="stop-color:#ff6b6b"/>
                <stop offset="50%" style="stop-color:#ff69b4"/>
                <stop offset="100%" style="stop-color:#ff1493"/>
              </linearGradient>
              <filter id="glow">
                <feGaussianBlur stdDeviation="4" result="coloredBlur"/>
                <feMerge>
                  <feMergeNode in="coloredBlur"/>
                  <feMergeNode in="SourceGraphic"/>
                </feMerge>
              </filter>
            </defs>
            <path d="M256 448l-30.29-27.52C118.22 319.91 48 258.83 48 179.91 48 114.25 97.91 64 163.09 64c36.31 0 71.11 17.04 93.13 44.04C278.23 81.04 313.03 64 349.34 64 414.52 64 464.43 114.25 464.43 179.91c0 78.92-70.22 140-177.71 240.57L256 448z"/>
          </svg>
          <div class="heart-quote">${loveQuotes[Math.floor(Math.random() * loveQuotes.length)]}</div>
        `;

        // 添加漂浮的小爱心
        for (let i = 0; i < 6; i++) {
          const miniHeart = document.createElement('div');
          miniHeart.className = 'heart-float';
          const side = i % 2 === 0 ? -1 : 1;
          const distance = 80 + (i * 20);
          miniHeart.style.cssText = `
            position: absolute;
            left: calc(50% + ${side * distance}px);
            top: 50%;
            width: 30px;
            height: 30px;
            animation: floatingHeart 1.5s ease-in-out infinite;
            animation-delay: ${i * 0.2}s;
          `;
          miniHeart.innerHTML = '<svg viewBox="0 0 32 32"><path fill="#FF69B4" d="M23.6,3.6c-2.1,0-4,1-5.6,2.7C16.4,4.6,14.5,3.6,12.4,3.6C8.1,3.6,4.6,7.1,4.6,11.4c0,7.1,11.4,16.9,11.4,16.9s11.4-9.8,11.4-16.9C27.4,7.1,23.9,3.6,23.6,3.6z"/></svg>';
          bigHeart.appendChild(miniHeart);
        }

        document.body.appendChild(bigHeart);

        setTimeout(() => {
          bigHeart.remove();
          isShowingBigHeart = false;
        }, 3000);
      }

      // 显示特殊彩蛋效果
      function showSpecialEffect(message) {
        if (document.querySelector('.special-effect')) return;

        const effectDiv = document.createElement('div');
        effectDiv.className = 'special-effect';
        
        const container = document.createElement('div');
        container.className = 'special-heart-container';
        
        container.innerHTML = `
          <svg viewBox="0 0 512 512">
            <defs>
              <linearGradient id="specialGradient" x1="0%" y1="0%" x2="100%" y2="100%">
                <stop offset="0%" style="stop-color:#ff1493"/>
                <stop offset="33%" style="stop-color:#ff69b4"/>
                <stop offset="66%" style="stop-color:#ff8da1"/>
                <stop offset="100%" style="stop-color:#ff1493"/>
              </linearGradient>
              <filter id="specialGlow">
                <feGaussianBlur stdDeviation="8" result="coloredBlur"/>
                <feMerge>
                  <feMergeNode in="coloredBlur"/>
                  <feMergeNode in="SourceGraphic"/>
                </feMerge>
              </filter>
            </defs>
            <path fill="url(#specialGradient)" filter="url(#specialGlow)" 
              d="M256 448l-30.29-27.52C118.22 319.91 48 258.83 48 179.91 48 114.25 97.91 64 163.09 64c36.31 0 71.11 17.04 93.13 44.04C278.23 81.04 313.03 64 349.34 64 414.52 64 464.43 114.25 464.43 179.91c0 78.92-70.22 140-177.71 240.57L256 448z"/>
          </svg>
          <div class="special-message">${message}</div>
        `;

        // 添加星星效果
        for (let i = 0; i < 12; i++) {
          const star = document.createElement('div');
          const size = Math.random() * 10 + 10;
          star.style.cssText = `
            position: absolute;
            width: ${size}px;
            height: ${size}px;
            background: #FFD700;
            clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
            left: ${Math.random() * 100}%;
            top: ${Math.random() * 100}%;
            animation: twinkle 1s ease-in-out infinite;
            animation-delay: ${Math.random()}s;
          `;
          container.appendChild(star);
        }
        
        effectDiv.appendChild(container);
        document.body.appendChild(effectDiv);
        
        setTimeout(() => effectDiv.remove(), 5000);
      }

      // 添加新的动画样式
      const style = document.createElement('style');
      style.textContent = `
        @keyframes orbitHeart {
          from { transform: rotate(0deg) translateX(150px) rotate(0deg); }
          to { transform: rotate(360deg) translateX(150px) rotate(-360deg); }
        }
        
        @keyframes twinkle {
          0%, 100% { opacity: 1; transform: scale(1); }
          50% { opacity: 0.5; transform: scale(0.5); }
        }
      `;
      document.head.appendChild(style);

      // 更新爱心计数的HTML结构
      heartCount.innerHTML = '<span>爱心：0</span>';

      // 初始化 Swiper
      swiper = initSwiper();
      
      // 开始飘落效果
      setInterval(createPetal, PETAL_INTERVAL);

      // 创建互动元素
      function createInteractiveElement(e) {
        const type = Math.random() > 0.5 ? 'heart' : 'petal';
        const element = document.createElement('div');
        const size = Math.random() * 20 + 20;
        
        if (type === 'heart') {
          element.className = 'heart-float';
          element.innerHTML = '<svg viewBox="0 0 32 32"><path fill="#FF69B4" d="M23.6,3.6c-2.1,0-4,1-5.6,2.7C16.4,4.6,14.5,3.6,12.4,3.6C8.1,3.6,4.6,7.1,4.6,11.4c0,7.1,11.4,16.9,11.4,16.9s11.4-9.8,11.4-16.9C27.4,7.1,23.9,3.6,23.6,3.6z"/></svg>';
        } else {
          element.className = 'interactive-element';
          element.innerHTML = '<svg viewBox="0 0 32 32"><path fill="#FFB6C1" d="M16 29S2 18 2 10a7 7 0 0 1 14 0 7 7 0 0 1 14 0c0 8-14 19-14 19z"/></svg>';
          element.style.animation = `rotatePetal ${Math.random() * 2 + 1}s linear infinite`;
        }

        Object.assign(element.style, {
          left: e.clientX + 'px',
          top: e.clientY + 'px',
          width: size + 'px',
          height: size + 'px',
          transform: 'translate(-50%, -50%)',
        });

        document.body.appendChild(element);

        // 如果是花瓣，添加飘落动画
        if (type === 'petal') {
          const duration = Math.random() * 2 + 2;
          const targetX = (Math.random() - 0.5) * 200;
          const targetY = window.innerHeight + 100;

          element.animate([
            { transform: 'translate(-50%, -50%) rotate(0deg)' },
            { transform: `translate(${targetX}px, ${targetY}px) rotate(360deg)` }
          ], {
            duration: duration * 1000,
            easing: 'linear'
          }).onfinish = () => element.remove();
        } else {
          // 心形元素3秒后移除
          setTimeout(() => element.remove(), 1500);
        }
      }

      // 点击添加爱心和互动元素
      document.addEventListener('click', (e) => {
        // 排除点击控制按钮和欢迎屏幕的情况
        if (e.target.closest('.controls') || e.target.closest('.welcome-screen') || 
            e.target.closest('.big-heart') || e.target.closest('.special-effect')) {
          return;
        }

        // 增加爱心计数
        hearts++;
        
        // 更新显示
        heartCount.querySelector('span').textContent = `爱心：${hearts}`;
        
        // 创建3-5个互动元素
        const count = Math.floor(Math.random() * 3) + 3;
        for (let i = 0; i < count; i++) {
          setTimeout(() => createInteractiveElement(e), i * 100);
        }

        // 检查是否为3的倍数（显示大爱心）
        if (hearts % 3 === 0) {
          showBigHeart();
        }
        
        // 特殊彩蛋触发条件
        if (hearts % 10 === 0) { // 每收集10个爱心触发一次彩蛋
          const randomMessage = specialMessages[Math.floor(Math.random() * specialMessages.length)];
          showSpecialEffect(randomMessage);
        }
      });

      // 欢迎屏幕点击事件
      welcomeScreen.addEventListener('click', () => {
        welcomeScreen.style.display = 'none';
        bgm.play().then(() => {
          playing = true;
          musicBtn.classList.add('animated');
        }).catch(console.error);
      });

      // 音乐控制
      musicBtn.addEventListener('click', () => {
        if (playing) {
          bgm.pause();
          musicBtn.classList.remove('animated');
        } else {
          bgm.play().then(() => musicBtn.classList.add('animated'));
        }
        playing = !playing;
      });
    });
  </script>
</body>
</html> 